package com.zsy.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.zsy.entity.SysUser;
import com.zsy.service.ISysUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 系统用户表 前端控制器
 * </p>
 *
 * @author lemon
 * @since 2017-06-01
 */
@Controller
@RequestMapping("/sysUser")
public class SysUserController {
    @Resource
    ISysUserService sysUserService;

    @ResponseBody
    @RequestMapping("")
    public List<SysUser> select() {
        return sysUserService.select();
    }

    @ResponseBody
    @RequestMapping("/select")
    public List<SysUser> selectAll() {
        return sysUserService.selectList(new EntityWrapper<SysUser>().between("age", "18", "50"));
    }

    @ResponseBody
    @RequestMapping("/page")
    public Page<SysUser> selectPage(ModelAndView modelAndView) {
        return sysUserService.selectPage(new Page<SysUser>(1, 1),null);
    }
}
